package com.yy.blogdemo.utils;

public class JsonData {
//状态码 0表示成功过 1表示处理中，-1，表示失败
    private  int code;

    private Boolean success;

    private String msg;

    private Object data;

    public JsonData() {
    }

    public JsonData(int code, boolean success,String msg ,Object data) {
        this.code = code;
        this.data=data;
        this.success=success;
        this.msg = msg;
    }

    public static JsonData buildSuccess(){
        return new JsonData(200,true,"",null);
    }

    public static JsonData buildSuccess(Object data){
        return new JsonData(200,true,null,data);
    }

    public static JsonData buildError(String msg){
        return new JsonData(-1,false,msg,null);
    }

    public static JsonData buildError(int code,String msg){
        return new JsonData(-1,false,msg,null);
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }
}
